package com.xzy.g;

import com.xzy.service.impl.StudentServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 说明：Bean生命周期之初始化前、初始化
 *
 * @author xzy
 * @date 2021/12/5 17:29
 */
@Slf4j
public class Main {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        applicationContext.register(MyInstantiationAwareBeanPostProcessor.class);
        applicationContext.register(MyPostConstructBeanPostProcessor.class);
        applicationContext.register(StudentServiceImpl.class);
        applicationContext.register(ServiceA.class);
        applicationContext.refresh();
        log.info("最终的Bean => {}", applicationContext.getBean(ServiceA.class));
    }
}
